/**
 * 传入指定日期的时间戳以获取倒计时字符串
 * @param {Number} futureTime 
 * @returns {String}
 */
export const restTime = (futureTime) => {
    if (isNaN(Number(futureTime))) {
      return 'futureTime参数格式错误！'
    }
    let nowTime = new Date().getTime()
    if (nowTime > futureTime) return '错误！传入的是过去的时间戳'
    let restTimeStamp = futureTime - nowTime

    let day = parseInt(restTimeStamp / (24 * 60 * 60 * 1000))
    let hour = parseInt(restTimeStamp / (60 * 60 * 1000) % 24)
    let min = parseInt(restTimeStamp / (60 * 1000) % 60)
    let sec = parseInt(restTimeStamp / 1000 % 60)

    return '剩余' + day + '天' + hour + '时' + min + '分' + sec + '秒'
}